<!DOCTYPE html>
<html>
<body>

<textarea id="myTextarea" onchange="showOnChange()" onkeyup="showOnKeyUp()"></textarea>

<p id="onChangeResult"></p>
<p id="onKeyUpResult"></p>

<script>
function showOnChange() {
  var x = document.getElementById("myTextarea").value;
  document.getElementById("onChangeResult").innerHTML = "onchange 事件触发，输入内容：" + x;
}

function showOnKeyUp() {
  var x = document.getElementById("myTextarea").value;
  document.getElementById("onKeyUpResult").innerHTML = "onkeyup 事件触发，输入内容：" + x;
}
</script>

</body>
</html>
